package com.eleven.service.impl;

import java.util.List;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eleven.dao.ProjectsMapper;
import com.eleven.dao.ProjectsTypeMapper;
import com.eleven.dao.UserMapper;
import com.eleven.pojo.Projects;
import com.eleven.pojo.ProjectsExample;
import com.eleven.pojo.UserExample;
import com.eleven.service.AdminProjectsService;
@Service
public class AdminProjectsServiceImpl implements AdminProjectsService {
	@Autowired
	ProjectsMapper projectsMapper;
	@Autowired
	ProjectsTypeMapper projectsTypeMapper;
	@Autowired
	UserMapper userMapper;
	
	public ProjectsMapper getProjectsMapper() {
		return projectsMapper;
	}

	public void setProjectsMapper(ProjectsMapper projectsMapper) {
		this.projectsMapper = projectsMapper;
	}

	public ProjectsTypeMapper getProjectsTypeMapper() {
		return projectsTypeMapper;
	}

	public void setProjectsTypeMapper(ProjectsTypeMapper projectsTypeMapper) {
		this.projectsTypeMapper = projectsTypeMapper;
	}

	public UserMapper getUserMapper() {
		return userMapper;
	}

	public void setUserMapper(UserMapper userMapper) {
		this.userMapper = userMapper;
	}
	
	/**
	 * 获取所有项目
	 */
	@Override
	public List<Projects> getAll() {
		// TODO Auto-generated method stub
		return projectsMapper.selectByExampleByPstAndUser(null);
	}
	/**
	 * 根据项目id获取项目
	 */
	@Override
	public List<Projects> getProjectById(Integer psid) {
		// TODO Auto-generated method stub
		ProjectsExample example=new ProjectsExample();
		example.createCriteria().andPsIdEqualTo(psid);
		return projectsMapper.selectByExampleByPstAndUser(example);
	}
	/**
	 * 按条件查询项目
	 */
	@Override
	public List<Projects> getAllByContinue(Projects projects) {
		// TODO Auto-generated method stub
			return projectsMapper.selectByExampleWithPstAndUser(projects);
	
	}
	/**
	 * 获取所有未审核项目
	 */
	@Override
	public List<Projects> getProjectsBypsType(Integer psType) {
		// TODO Auto-generated method stub
		ProjectsExample example=new ProjectsExample();
		example.createCriteria().andPsTypeEqualTo(psType);
		return projectsMapper.selectByExampleByPstAndUser(example);
	}


	

	
}
